@extends('admin.layout.layout')
@section('content')



@component('admin.components.content.formContent')
@slot('rightContent')
<form class="form-material mini-form ajaxForm" method="POST" @if(isset($editData)) action="{{url('/admin/category',['id'=>$editData->id])}}" @else action="{{url('/admin/category')}}" @endif)>
    @isset($editData)
        @method('PUT')
    @endisset
    @csrf
    <div class="body">
        <h6>父级菜单</h6>
        <select name="pid" class="form-control mt-2 mb-2">
                <option value="0">└───根菜单</option>
                @forelse($selectData as $item)
                    <option @if(isset($default)&&$item->id==$default) selected @endif value="{{$item->id}}">{!!str_repeat("&nbsp;",($item->level-1)*10)!!}└───{{$item->category_name}}</option>
                @empty
                    <option value="">组件未收到数据</option>
                @endforelse
        </select>



        @component('admin.components.input',[
            'min'=>'3',
            'title'=>'分类名称',
            'name'=>'category_name',
            'default'=>isset($editData)?$editData->category_name:''
            ])
        @endcomponent
            
        
        <h6>形状约束</h6>
        
        <div class="row">
                <div class="col-md-12">
                        <select name="shape_id" class="form-control mt-2 mb-3 col-md-12" required>
                                @foreach ($shapeList as $item)
                                    <option @if(isset($editData)&&$editData->shape_id==$item->id) selected @endif value="{{$item->id}}">{{$item->shape_name}}</option>
                                @endforeach
                        </select>
                </div>
        </div>

        <button type="submit" class="btn btn-primary mt-2"><i class="icon-arrow_forward mr-2"></i>提交</button>

    </div>
</form>
@endslot
@endcomponent


 
@endsection